<?php
include_once "DB.class.php";
// $DB=new PDO("mysql:host=localhost;dbname=curl",'root','root');

//白名单数据变成一维数组
function white_arr($white_arr){
	foreach ($white_arr as $k => $v) {
		$arr[]=$v['title'];
		# code...
	}
	return $arr;
}
while (1 <= 10) {
	# code...

$sql="select id,error from article where status = 2";
$rr=$DB->queryOne($sql);
if ($rr!='') {
	# code...

$ex_arr=explode(",",$rr['error']);
 $white_arr=$DB->queryAll("select * from white_list");
 $white_arr=white_arr($white_arr);
foreach ($ex_arr as $k => $v) {
	if (!in_array($v,$white_arr)) {
		$v=trim($v);
		$sql3="insert into illegal (title) value ('".$v."')";
		$re=$DB->exec($sql3);
		if ($re) {
			echo 1;
			# code...
		}else{
			echo 0;
		}
	}
	# code...
}

	$sql2="update article set status = 3 where id =".$rr['id'];
	$re=$DB->exec($sql2);
	echo 'over';
	}

}
